package com.chenyaowei.cart.bo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 购物项内容
 */
public class CartItemBO implements Serializable {

    private Long spuId;

    private Long catelogId;

    private Long skuId;

    private Boolean checked;

    private String title;

    private String skuPic;

    private List<SaleAttrValue> skuAttrsVals;

    private BigDecimal price;

    private Integer count;

    private BigDecimal totalPrice;

    public static class SaleAttrValue{
        /** 序号 */
        private Long id;

        /** 属性id */
        private Long attrId;

        /** 属性名 */
        private String attrName;

        /** 属性值 */
        private String attrValue;

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public Long getAttrId() {
            return attrId;
        }

        public void setAttrId(Long attrId) {
            this.attrId = attrId;
        }

        public String getAttrName() {
            return attrName;
        }

        public void setAttrName(String attrName) {
            this.attrName = attrName;
        }

        public String getAttrValue() {
            return attrValue;
        }

        public void setAttrValue(String attrValue) {
            this.attrValue = attrValue;
        }

        @Override
        public String toString() {
            return "SaleAttrValue{" +
                    "id=" + id +
                    ", attrId=" + attrId +
                    ", attrName='" + attrName + '\'' +
                    ", attrValue='" + attrValue + '\'' +
                    '}';
        }
    }

    public Long getSpuId() {
        return spuId;
    }

    public void setSpuId(Long spuId) {
        this.spuId = spuId;
    }

    public Long getCatelogId() {
        return catelogId;
    }

    public void setCatelogId(Long catelogId) {
        this.catelogId = catelogId;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSkuPic() {
        return skuPic;
    }

    public void setSkuPic(String skuPic) {
        this.skuPic = skuPic;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public List<SaleAttrValue> getSkuAttrsVals() {
        return skuAttrsVals;
    }

    public void setSkuAttrsVals(List<SaleAttrValue> skuAttrsVals) {
        this.skuAttrsVals = skuAttrsVals;
    }

    /**
     * 计算当前项的总价
     * @return
     */
    public BigDecimal getTotalPrice() {

        return this.price.multiply(new BigDecimal(this.count));
    }
}
